<table width="100%" border="0" cellpadding="0" cellspacing="1" class="STYLE1" bgcolor="b5d6e6">
  <tr>
    <td colspan="3" align="left" background='<%=$urr+"skin/images/bg.gif"%>'><img src='<%=$urr+"skin/icon/web_icon_015.gif"%>' width="16" height="16" />
      <span class="STYLE3"><%=@titles %></span></td>
  </tr>
</table>
<fieldset>
  <% form_for :ad, @ad, :url => { :action => "update" } do |f| %>
    <%= hidden_field :ad, :id %>
    <p>
      <%= f.label :name,"广告名称" %><br />
      <%= f.text_field :name %>
    </p>

    <p>
      <%= f.label :url,"URL" %><br />
      <%= f.text_field :url %>
    </p>

    <p>
      <%= f.label :orders,"位置" %><br />
      <%if @ad.orders.to_i == 1%>
        <%= f.label "首页" %> <%= radio_button :ad, :orders, 1, :checked => true %>
        <%= f.label "栏目页" %> <%= radio_button :ad, :orders, 2, :checked => false %>
        <%= f.label "资源页" %> <%= radio_button :ad, :orders, 3, :checked => false %>
        <%= f.label "固定位" %> <%= radio_button :ad, :orders, 4, :checked => false %>
      <%elsif @ad.orders.to_i == 2%>
        <%= f.label "首页" %> <%= radio_button :ad, :orders, 1, :checked => false %>
        <%= f.label "栏目页" %> <%= radio_button :ad, :orders, 2, :checked => true %>
        <%= f.label "资源页" %> <%= radio_button :ad, :orders, 3, :checked => false %>
        <%= f.label "固定位" %> <%= radio_button :ad, :orders, 4, :checked => false %>
      <%elsif @ad.orders.to_i == 3%>
        <%= f.label "首页" %> <%= radio_button :ad, :orders, 1, :checked => false %>
        <%= f.label "栏目页" %> <%= radio_button :ad, :orders, 2, :checked => false %>
        <%= f.label "资源页" %> <%= radio_button :ad, :orders, 3, :checked => true %>
        <%= f.label "固定位" %> <%= radio_button :ad, :orders, 4, :checked => false %>
      <%elsif @ad.orders.to_i == 4%>
        <%= f.label "首页" %> <%= radio_button :ad, :orders, 1, :checked => false %>
        <%= f.label "栏目页" %> <%= radio_button :ad, :orders, 2, :checked => false %>
        <%= f.label "资源页" %> <%= radio_button :ad, :orders, 3, :checked => false %>
        <%= f.label "固定位" %> <%= radio_button :ad, :orders, 4, :checked => true %>
      <%else%>
        <%= f.label "首页" %> <%= radio_button :ad, :orders, 1, :checked => true %>
        <%= f.label "栏目页" %> <%= radio_button :ad, :orders, 2, :checked => false %>
        <%= f.label "资源页" %> <%= radio_button :ad, :orders, 3, :checked => false %>
        <%= f.label "固定位" %> <%= radio_button :ad, :orders, 4, :checked => false %>
      <%end%>
    </p>

    <p>
      <%= f.label :x,"X坐标" %><br />
      <%= f.text_field :x %>
    </p>

    <p>
      <%= f.label :y,"Y坐标" %><br />
      <%= f.text_field :y %>
    </p>

    <p>
      <%= f.label :desc,"描述" %><br />
      <%= f.text_field :desc %>
    </p>

    <p>
      <%= f.label :status,"状态" %><br />
      <%if @ad.status.to_i == 1%>
        <%= f.label "开放" %> <%= radio_button :ad, :status, "1", :checked => true %>
        <%= f.label "关闭" %> <%= radio_button :ad, :status, "0", :checked => false %>
      <%else%>
        <%= f.label "开放" %> <%= radio_button :ad, :status, "1", :checked => false %>
        <%= f.label "关闭" %> <%= radio_button :ad, :status, "0", :checked => true %>
      <%end%>

    </p>

    <p>
      <%= f.submit '确定' %>       &nbsp;&nbsp;&nbsp;&nbsp;<%= link_to '返回列表', url_for(:back) %>
    </p>
  <% end %>
</fieldset>